package com.barisergun.tdd.samples;

import java.io.PrintStream;

public class ClassThatOutputsHelloMessage {

	private PrintStream outputStream;

	private NameProviderInterface nameProviderInterface;

	public ClassThatOutputsHelloMessage (
			NameProviderInterface nameProviderInterface,
			PrintStream outputStream) {
		this.outputStream = outputStream;
		this.nameProviderInterface = nameProviderInterface;
	}

	public void sayHello () {
		if (nameProviderInterface == null)
			outputStream.println ("Hello");
		else
			outputStream.println ("Hello "
				+ nameProviderInterface.getNextName ());
	}
}
